<div class="span3 hide" id="user-role-edit-block">
	<button class="btn btn-mini" id="switch-user-role-add-btn">
		<i class="icon-backward"></i> <?php echo t('buttons', 'Back to Add'); ?>
	</button>
	<h4 class="title"><?php echo t('page', 'Edit User Role'); ?></h4>
	<div class="squiggly-border"></div>
	<div class="row-fluid">
		<div class="span12 edit_user_role_form_info hide" id="edit_user_role_success_info">
			<div class="alert alter-block">
	<!--			<button type="button" class="close" data-dismiss="alert">&times;</button>-->
				<h4>Success!</h4>
				<div class="content">User role has been saved!</div>
			</div>
		</div>
	</div>
	
	<div class="row-fluid">
		<div class="span12 edit_user_role_form_info hide" id="edit_user_role_error_info">
			<div class="alert alter-block">
	<!--			<button type="button" class="close" data-dismiss="alert">&times;</button>-->
				<h4>Warning!</h4>
				<div class="content"></div>
			</div>
		</div>
	</div>
	
	<?php $form = $this->beginWidget('CActiveForm', array(
		'id' => 'role-edit-form',
		'enableClientValidation' => true,
		'clientOptions' => array(
			'validateOnSubmit' => true,
		),
	)); ?>
	
		<?php echo $form->hiddenField($userRoleEditForm, 'id_user_role', array('class' => 'fields')); ?>
		
		<div class="row-fluid">
			<?php echo $form->textField($userRoleEditForm, 'name', array('placeholder' => $userRoleEditForm->getFieldLabel('name'), 'class' => 'fields')); ?>
		</div>
	
		<div class="row-fluid">
			<?php echo $form->textArea($userRoleEditForm, 'description', array('placeholder' => $userRoleEditForm->getFieldLabel('description'), 'class' => 'fields')); ?>
		</div>
	
		<div class="row-fluid buttons">
			<?php echo CHtml::ajaxSubmitButton(
				t('buttons', 'Edit User Role'), 
				app()->createUrl('user/editrole'),
				array(
					'type' => 'post',
					'beforeSend' => 'function(){
						$("#edit_user_role_submit").button("loading");
					}',
					'success' => 'function(ret){
						$(".edit_user_role_form_info").hide();
						if(ret["result"]){
							$("#edit_user_role_success_info").blink({
								"beforeCall": function(){
									$(".user_role_edit-line .name").text($("#UserRoleEditForm_name").val());
									$(".user_role_edit-line .description").text($("#UserRoleEditForm_description").val());
								}
							});
						}else{
							$("#edit_user_role_error_info").blink({
								"beforeCall": function(){
									$("#edit_user_role_error_info .content").html("");
									$.each(ret["errors"], function(attrName, error){
										$(error).each(function(k, e){
											var p = $("<p />").addClass("text-error").append(attrName+": "+e);
											$("#edit_user_role_error_info .content").append(p);
										});
									});
								}
							});
						}
						
						$("#edit_user_role_submit").button("reset");
					}',
					'dataType' => 'json'
				),
				array(
					'id' => 'edit_user_role_submit',
					'type' => 'button', 
					'class' => 'btn btn-small btn-primary',
					'data-loading-text' => t('buttons', 'Saving...')
				)
			); ?>
		</div>
	
	<?php $this->endWidget(); ?>
</div>